using System;
using System.Runtime.InteropServices;

namespace Handrise.Mobile.BasicModal.Audio
{
	[StructLayout(LayoutKind.Sequential)] 
	public class WaveFormat
	{
		/// <summary>
		/// 
		/// </summary>
		public short wFormatTag;
		public short nChannels;
		public int nSamplesPerSec;
		public int nAvgBytesPerSec;
		public short nBlockAlign;
		public short wBitsPerSample;
		public short cbSize;

		public WaveFormat(int rate, int bits, int channels)
		{
            wFormatTag = (short)WaveFormats.Pcm;
            nChannels = (short)channels;
            nSamplesPerSec = rate;
            wBitsPerSample = (short)bits;
            cbSize = 0;

            nBlockAlign = (short)(channels * (bits / 8));
            nAvgBytesPerSec = nSamplesPerSec * nBlockAlign;

            //wFormatTag = (short)WaveFormats.WAVE_FORMAT_GSM610 ;
            //nChannels = (short)channels;
            //nSamplesPerSec = rate;
            //wBitsPerSample = (short)bits;
            //cbSize = 2;

            //nBlockAlign = 65;
            //nAvgBytesPerSec = 1625;
            //reserved[0] =
		}
	}
}
